home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / System 7.0 Samples / ProcDoggie 1.0a6 / UGlobals.p < prev    next >
Encoding:
Text File  |  1994-11-18  |  8.0 KB  |  214 lines  |  [TEXT/MPS ]

  1. UNIT UGlobals;
  2.  
  3.  
  4. {-------------------------------------------------------------------------------
  5. #
  6. #    Apple Macintosh Developer Technical Support
  7. #
  8. #    Interfaces for the application utilities
  9. #
  10. #    Program:    ProcDoggie
  11. #    File:        UGlobals.p - Pascal Implementation
  12. #
  13. #    by:        Forrest Tanaka
  14. #
  15. #    Copyright © 1988-1991 Apple Computer, Inc.
  16. #    All rights reserved.
  17. #
  18. --------------------------------------------------------------------------------
  19. #
  20. # This unit contains declarations and routines that didn’t seem to fit into any
  21. # other unit in this application.
  22. #
  23. -------------------------------------------------------------------------------}
  24.  
  25.  
  26. INTERFACE
  27.  
  28.  
  29. (*******************************************************************************
  30. * Used Units
  31. *******************************************************************************)
  32.  
  33.     USES
  34.         (* Group 1 *)
  35.          Types
  36.         ,QuickDraw
  37.  
  38.         (* Group 2 *)
  39.         ,Controls
  40.         ,Errors
  41.         ,Events
  42.         ,Files
  43.         ,GestaltEqu
  44.         ,Memory
  45.         ,Resources
  46.         ,TextEdit
  47.         ,ToolUtils
  48.  
  49.         (* Group 3 *)
  50.         ,Notification
  51.         ,Processes
  52.         ,Windows
  53.  
  54.         (* Group 4 *)
  55.         ,Dialogs
  56.  
  57.         (* Application *)
  58.         ,UEmergMem
  59.         ;
  60.  
  61.  
  62. (*******************************************************************************
  63. * Constants
  64. *******************************************************************************)
  65.  
  66.     CONST
  67.         rMemErrMessages        = 1000; {Resource ID of memory error message STR#}
  68.         kMemErrAppOpenMsg      = 1;    {Not enough memory to open application}
  69.         kMemErrProcListOpenMsg = 2;    {Not enough mem to open process list wind}
  70.         kMemErrLowMemWarnMsg   = 3;    {Free memory is low; proceed with caution}
  71.         kMemErrProcInfoOpenMsg = 4;    {Not enough mem to open process info wind}
  72.  
  73.         rResErrMessages     = 1001; {Resource ID of resource error message STR#}
  74.         kResErrAppDamageMsg = 1;    {Application is damaged}
  75.  
  76.         rMiscErrMessages   = 1002; {Resource ID of misc. error message STR#}
  77.         kMiscErrUnknownMsg = 1;    {Unknown error}
  78.  
  79.         rMiscWrnMessages     = 2000; {Resource ID of misc. warning message STR#}
  80.         kMiscWrnUncleanMsg   = 1;    {Application not 32-bit clean warning}
  81.         kMiscWrnLaunchMemMsg = 2;    {Not enough memory to launch}
  82.  
  83.         kMaxSleepTime = 60; {Max WNE sleep time in ticks, 1 second in this case}
  84.  
  85.  
  86. (*******************************************************************************
  87. * Global Variables
  88. *******************************************************************************)
  89.  
  90.     VAR
  91.         gError:        Integer; {Generic application error code}
  92.         gWereInFront:  Boolean; {TRUE if this appliation is front most}
  93.         gQuitting:     Boolean; {TRUE if user chose Quit command}
  94.  
  95.  
  96. (*******************************************************************************
  97. * DoQuit - Handle Quit command
  98. *
  99. * This routine is called when this application should quit.  It’s called
  100. * when the user chooses the Quit command from the file menu or when a 'quit'
  101. * AppleEvent is received.
  102. *******************************************************************************)
  103.  
  104.     PROCEDURE DoQuit;
  105.  
  106.  
  107. (*******************************************************************************
  108. * ShowStopAlert - Show a stop alert
  109. *
  110. * This routine puts up a standard stop alert with just an OK button and a
  111. * specified message.  messageClass specifies the STR# resource ID which contains
  112. * the message to display and messageIndex specifies the index (the first message
  113. * is index 1) into that STR# of the message to display.
  114. *******************************************************************************)
  115.  
  116.     FUNCTION ShowStopAlert (messageClass: Integer;
  117.                             messageIndex: Integer): Integer;
  118.  
  119.  
  120. (*******************************************************************************
  121. * ShowCautionOKCancelAlert - Show a caution alert with an OK and Cancel button
  122. *
  123. * This routine puts up a standard caution alert with just an OK button, a Cancel
  124. * button, and a specified message.  messageClass specifies the STR# resource ID
  125. * which contains the message to display and messageIndex specifies the index
  126. * (the first message is index 1) into that STR# of the message to display.
  127. *******************************************************************************)
  128.  
  129.     FUNCTION ShowCautionOKCancelAlert (messageClass: Integer;
  130.                                        messageIndex: Integer): Integer;
  131.  
  132.  
  133. (*******************************************************************************
  134. * ShowCautionOKAlert - Show a caution alert with just an OK button
  135. *
  136. * This routine puts up a standard caution alert with just an OK button and a
  137. * specified message.  messageClass specifies the STR# resource ID which contains
  138. * the message to display and messageIndex specifies the index (the first message
  139. * is index 1) into that STR# of the message to display.
  140. *******************************************************************************)
  141.  
  142.     FUNCTION ShowCautionOKAlert (messageClass: Integer;
  143.                                  messageIndex: Integer): Integer;
  144.  
  145.  
  146. (*******************************************************************************
  147. * ShowAboutBox - Show the About box
  148. *
  149. * The About box for this application is displayed.  This is just a simple alert
  150. * box with an OK button.  The name of this application is displayed as is its
  151. * version number.
  152. *******************************************************************************)
  153.  
  154.     PROCEDURE ShowAboutBox;
  155.  
  156.  
  157. (*******************************************************************************
  158. * CreateWindow - Create a window
  159. *
  160. * This routine creates a window using the WIND resource template with a resource
  161. * ID of windowTmplID in front of all existing windows.  A pointer to this window
  162. * is returned.  If we’re running on a Color QuickDraw machine, the window is
  163. * created as a color window.  This window must be disposed of by calling
  164. * CloseWindow followed by DisposePtr on the window’s WindowRecord.  The window
  165. * shouldn’t be closed using DisposeWindow.  When this routine returns, the new
  166. * window is the current GrafPort.
  167. *
  168. * The window isn’t explicitly repositioned from its position as defined by the
  169. * resource definition.  Instead, I use the window-positioning utilities.  This
  170. * isn’t documented at this time and it isn’t even certain the these utilities
  171. * will be implemented in the final release of system software 7.0.  Use ResEdit
  172. * 2.1’s WIND editor to control the window-positioning utilities.
  173. *
  174. * If there isn’t enough memory for the window, then gError global is set to
  175. * memFullErr.  If the WIND resource couldn’t be loaded, gError is set to
  176. * resNotFound.  If anything else went wrong while creating the window, then
  177. * gError is set to dsSysErr.
  178. *******************************************************************************)
  179.  
  180.     FUNCTION CreateWindow (windowTmplID: Integer): WindowPtr;
  181.  
  182.  
  183. (*******************************************************************************
  184. * CreateDialog - Create a dialog window
  185. *
  186. * This routine creates a dialog window using the WIND resource template with a
  187. * resource ID of windowTmplID in front of all existing windows.  A pointer to
  188. * this window is returned.  If we’re running on a Color QuickDraw machine, the
  189. * window is created as a color window.  This window must be disposed of by
  190. * calling CloseWindow followed by DisposePtr on the window’s DialogRecord.  The
  191. * window shouldn’t be closed using DisposeWindow.  When this routine returns,
  192. * the new dialog is the current GrafPort.
  193. *
  194. * The window isn’t explicitly repositioned from its position as defined by the
  195. * resource definition.  Instead, I use the window-positioning utilities.  This
  196. * isn’t documented at this time and it isn’t even certain the these utilities
  197. * will be implemented in the final release of system software 7.0.  Use ResEdit
  198. * 2.1’s WIND editor to control the window-positioning utilities.
  199. *
  200. * If there isn’t enough memory for the window, then gError global is set to
  201. * memFullErr.  If the WIND resource couldn’t be loaded, gError is set to
  202. * resNotFound.  If anything else went wrong while creating the window, then
  203. * gError is set to dsSysErr.
  204. *******************************************************************************)
  205.  
  206.     FUNCTION CreateDialog (dialogTmplID: Integer): DialogPtr;
  207.  
  208.  
  209. IMPLEMENTATION
  210.  
  211.     {$I UGlobals.inc1.p}
  212.  
  213. END.
  214.